{%- macro adminMenu(data,h) %}
  <ul class="treeview-menu">
    {% for key,value in h %}
      {% if key == value %}
        <li><a data-target="#main" href="{{ url(data[key]['href']) }}">{% if data[key]['icon'] is defined %}<i class="{{ data[key]['icon'] }}"></i>{% endif %}<span>{{ data[key]['name'] }}</span></a></li>
      {% elseif is_array(value) == true %}
        <li><a href="#">{% if data[key]['icon'] is defined %}<i class="{{ data[key]['icon'] }}"></i>{% endif %}<span>{{ data[key]['name'] }}</span><i class="fa fa-angle-left pull-right"></i></a>
        {{ adminMenu(data,value) }}
        </li>
      {% endif %}
    {% endfor %}
  </ul>
{%- endmacro %}
<ul class="sidebar-menu">
  {% for key,value in hierarchy %}
      {% if key == value %}
        <li><a data-target="#main" href="{{ url(data[key]['href']) }}">{% if data[key]['icon'] is defined %}<i class="{{ data[key]['icon'] }}"></i>{% endif %}<span>{{ data[key]['name'] }}</span></a></li>
      {% elseif is_array(value) == true %}
        <li><a href="#{{ url(data[key]['href']) }}">{% if data[key]['icon'] is defined %}<i class="{{ data[key]['icon'] }}"></i>{% endif %}<span>{{ data[key]['name'] }}</span><i class="fa fa-angle-left pull-right"></i></a>
        {{ adminMenu(data,value) }}
        </li>
      {% endif %}
    {% endfor %}
</ul>
